<?php
require dirname(__FILE__) . '/../../../auto_load.php';
class ArticleDbTest extends PHPUnit_Framework_TestCase
{
	private $dtd_db;
	
	public function setUp()
	{
		$this->dtd_db = new ArticleDb();
	}
	
	public function testDelete()
	{
		$result = $this->dtd_db->delete();
		var_dump($result);
	}
	
	public function testInsertRow()
	{
		$data = array(
			'tag' => 'linux,lamp,mysql',
			'title' => 'Hello World',
			'content' => '<p>Hello World.</p><p>你好，世界。</p>',
			'author_name' => 'Jim Green',
			'original_uri' => 'http://example.com',
			'user_id' => '18446744073709551616',
			'written_language_id' => '1',
			'is_allow_comment' => '1',
			'filename' => 'test',
			'publish_to_where' => '1',
			'publish_time' => '1304565505',
			'update_time' => '1304565505',
			'publish_time_on_this_site' => '1304565505',
			'is_original' => '1',
			'dtd_id' => '1',
			'content_type_id' => '1'
		);
		$result = $this->dtd_db->insertRow($data);
		var_dump($result);
	}
	
	public function testInsertRows()
	{
		$data = array(
			array(
				'value' => 'html5'
			),
			array(
				'value' => 'xhtml_1.0_transitional'
			)
		);
		$result = $this->dtd_db->insertRows($data);
		var_dump($result);
	}
	public function testSelectCount()
	{
		//$where = array('id'=>1);
		$result = $this->dtd_db->selectCount();
		var_dump($result);
	}
	
	public function testSelectRow()
	{
		$where = array('id'=>1);
		$result = $this->dtd_db->selectRow($where);
		var_dump($result);
	}
	
	public function testSelectRows()
	{
		$result = $this->dtd_db->selectRows();
		var_dump($result);
	}
	
	public function testUpdate()
	{
		$where = array('id'=>1);
		$data = array(
			'value' => 'asdf'
		);
		$result = $this->dtd_db->update($where,$data);
		var_dump($result);
	}
}
?>